<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>点击然后计数</title>
		<script src="../js/vue.js"></script>
	</head>
	<body>
		
		<div id="app">
			<h2>点击计数{{counter}}</h2>
		<button @click="add">+</button>
		<button v-on:click="sub">-</button>
</div>
		
		<script>
			let app = new Vue({
				el: '#app',
				data: {
					counter:0
				},
				methods: {
					add(){
						console.log("add")
						this.counter++
					},
					sub(){
						console.log("sub")
						this.counter--
					}
				}
			})
		</script>
	</body>
</html>
